import Gender from "./interfaces/Gender";

SetTokenSecret('SECRET');
const cloudAdminConfig: RouterMapOptions = {
  router: [
    {
      path: '/users',
      meta: { title: '用户列表', icon: 'el-icon-user' },
      children: [
        {
          path: 'users',
          meta: { title: '用户管理', config: 'users' },
        },
      ],
    },

    {
      path:'/classroom',
      meta:{title:'班级',icon:'el-icon-user'},
      children: [
        {
          path:'/classroom',
          meta:{title: '班级',config: 'classroom'},
        }
      ],
    },

    {
      path: '/activity',
      meta:{title: '社团活动',icon:'el-icon-user'},
      children: [
        {
          path: 'activity',
          meta:{title: '社团活动',config: 'activity'},
        },
      ],
    }




  ],
  table: {

    users: {
      table: 'Users',

      columns: [
        {
          key: 'nickName',
          title: '昵称',
          search: true,
        },

        {
          key: 'sex',
          title: '性别',
          type: 'status',
          mapper: {
            [Gender.Unknown]: ['未知', 'info'],
            [Gender.Male]: ['男', 'warning'],
            [Gender.Female]: ['女', 'success'],
          },
          width: 50,
          required: false,
        },

        {
          key:'classroomId',
          title:'班级',
          type:'searchSelect',
          selectOption:[],
          mapTo:{table:'Classroom',key:'id',value:'title',in:true}
        },

        {
          key:'avatarUrl',
          title:'头像',
          type:'picture'
        },

        {
          key:'createAt',
          title:'加入时间',
          type:'dateTime',
          edit:false
        }
      ],
      permission: {
        add: true,
        edit: true,
        delete: true,
        search: true,
      },
    },


    classroom:{
      table:'Classroom',

      columns: [
        {
          key:'title',
          title:'班级名称',
          search:true
        }
      ],

      permission: {
        add:true,
        edit:true,
        delete: true,
        search: true
      }
    },

    activity:{
      table:'Activity',

      columns:[
        {
          key:'title',
          title:'名称',
          search:true
        },

        {
          key:'banner',
          title:'轮播图',
          search:true,
          type:'pictureGroup'
        }
      ],
      permission:{
        add:true,
        edit:true,
        delete:true,
        search:true
      }
    }

  },
};
SetRouterMap(
  JSON.stringify(cloudAdminConfig, (k, v) => {
    if (typeof v === 'function') {
      return v + '';
    }
    return v;
  })
);
